FROM python:3.6-slim

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

RUN printf "\
    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free \n\
    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free \n\
    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free \n\
    deb http://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free \n\
    " > /etc/apt/sources.list && \
    apt-get -qq update \
    && apt-get install -y --no-install-recommends \
    wget

RUN apt update -y
RUN apt install -y cmake
RUN apt install -y libgl1-mesa-glx
RUN apt install -y build-essential
RUN apt install -y libglib2.0-0 libsm6 libxrender1 libxext6

ENV PYTHONUNBUFFERED=TRUE

RUN mkdir -p /app
ADD . /app/
WORKDIR /app

RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:17001", "app:app"]

EXPOSE 17001